<script type="text/javascript">
$(function() {
	var sWidth = $("#slide-fade").width(); 
	var len = $("#slide-fade ul li").length; 
	var index = 0;
	var picTimer;
	
	var btn = "<div class='slide-text'></div><div class='btnBg'></div><div class='btn'>";
	for(var i=0; i < len; i++) {
		btn += "<span></span>";
	}
	btn += "</div>";
	$("#slide-fade").append(btn);
	$("#slide-fade .btnBg").css("opacity",0.5);

	$("#slide-fade .btn span").css("opacity",0.4).mouseenter(function() {
		index = $("#slide-fade .btn span").index(this);
		showPics(index);
	}).eq(0).trigger("mouseenter");

	$("#slide-fade ul").css("width",sWidth * (len));
	$("#slide-fade").hover(function() {
		clearInterval(picTimer);
	},function() {
		picTimer = setInterval(function() {
			showPics(index);
			index++;
			if(index == len) {index = 0;}
		},4000);
	}).trigger("mouseleave");
	
	function showPics(index) {
		var nowLeft = -index*sWidth;
		$("#slide-fade ul").stop(true,false).animate({"left":nowLeft},300); 
		//$("#slide-fade .btn span").removeClass("on").eq(index).addClass("on");
		$("#slide-fade .btn span").stop(true,false).animate({"opacity":"0.4"},300).eq(index).stop(true,false).animate({"opacity":"1"},300);
		$("#slide-fade .slide-text").text($("#slide-fade ul li").eq(index).find("img").attr("alt"));
	}
});
</script>
<div id="slide-fade">
  <ul>
    <volist name="ad" id="ad">
      <li><a <eq name="ad['nofollow']" value="1">rel="nofollow"</eq> href="{$ad['url']}" title="{$ad['title']}" target="_blank"><img src="{$ad['pic']}" width="970" height="350" alt="{$ad['title']}" /></a></li>
    </volist>
  </ul>
</div>